package com.jt.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.jt.dubbo.pojo.User;
import com.jt.dubbo.service.UserService;
import com.jt.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User findUserById(Long userId) {
        return userMapper.selectById(userId);
    }

    @Override
    public List<User> findObjects() {
        return userMapper.selectList(null);
    }

    @Override
    public void saveObject(User user) {
        userMapper.insert(user);
    }

    @Override
    public void deleteById(Long userId) {
        userMapper.deleteById(userId);
    }

    @Override
    public void updateObject(User user) {
        userMapper.updateById(user);
    }
}
